/*
 * Fichier : PolicesCaracteres.java
 * Créé le : 8 février 2007.
 * Modifié : 15 avril 2012.
 * Auteurs : Sébastien ESTIENNE.
 * SiteWeb : http://www.prog-info.org/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

package chapitre11;



import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import javax.swing.JFrame;



/**
 * <p>Classe utilisant les polices de caractères.</p>
 * @author Sébastien ESTIENNE.
 */
public class PolicesCaracteres extends JFrame
{
   /**
    * <p>Serial version UID.</p>
    */
   private static final long serialVersionUID = 1L;


   /**
    * <p>Constructeur initialisant la fenêtre.</p>
    */
   public PolicesCaracteres()
   {
      super("Polices de caractères");

      // Propriétés de la fenêtre.
      setLocation(50, 50);
      setSize(300, 150);
      setVisible(true);
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }


   /**
    * <p>Dessine la fenêtre.</p>
    * @param g Le contexte graphique utilisé pour dessiner.
    */
   @Override
   public void paint(Graphics g)
   {
      // Monospaced 10 pt normal bleu.
      g.setColor(Color.BLUE);
      g.setFont(new Font("Monospaced", Font.PLAIN, 10));
      g.drawString("Monospaced 10 pt normal bleu.", 40, 60);

      // Serif 12 pt gras rouge.
      g.setColor(Color.RED);
      g.setFont(new Font("Serif", Font.BOLD, 12));
      g.drawString("Serif 12 pt gras rouge.", 40, 90);

      // Sans Serif 14 pt italique vert.
      g.setColor(Color.GREEN);
      g.setFont(new Font("Sans Serif", Font.ITALIC, 14));
      g.drawString("Sans Serif 14 pt italique vert.", 40, 120);
   }


   /**
    * <p>Commence l'exécution du programme.</p>
    * @param args Les paramètres de la ligne de commande.
    */
   public static void main(String[] args)
   {
      new PolicesCaracteres();
   }
}
